home *** CD-ROM | disk | FTP | other *** search
- ///////////////////////////////////////////////////////////////////////////////
- // $Id: BasicDevice.cxx,v 1.1 1994/02/18 19:48:06 bmott Exp $
- ///////////////////////////////////////////////////////////////////////////////
- // BasicDevice.cxx - Device base class
- //
- // This is the abstract base class for all derived devices
- //
- //
- // BSVC "A Microprocessor Simulation Framework"
- // Copyright (c) 1993
- // By: Bradford W. Mott
- // November 26,1993
- //
- ///////////////////////////////////////////////////////////////////////////////
- // $Log: BasicDevice.cxx,v $
- // Revision 1.1 1994/02/18 19:48:06 bmott
- // Initial revision
- //
- ///////////////////////////////////////////////////////////////////////////////
-
- #include "BasicCPU.hxx"
- #include "BasicDevice.hxx"
-
- ///////////////////////////////////////////////////////////////////////////////
- // Reset device - At the very least the interrupt pending flag has to be reset
- ///////////////////////////////////////////////////////////////////////////////
- void BasicDevice::Reset()
- {
- interrupt_pending=0;
- }
-
- ///////////////////////////////////////////////////////////////////////////////
- // Interrupt Request - This routine should set the interrupt_pending flag and
- // send a request to the CPU for an interrupt.
- ///////////////////////////////////////////////////////////////////////////////
- void BasicDevice::InterruptRequest(int level)
- {
- // If no interrupt is pending then request one
- if(!interrupt_pending)
- {
- interrupt_pending=1;
- cpu->InterruptRequest(this, level);
- }
- }
-
- ///////////////////////////////////////////////////////////////////////////////
- // Interrupt Acknowledge - This routine is called by the CPU when it processes
- // the requested interrupt. It should return the
- // vector number associated with the interrupt or
- // AUTOVECTOR if the device doesn't generate vectors.
- //
- // NOTE: This default routine only does AUTOVECTOR
- // interrupts.
- //
- ///////////////////////////////////////////////////////////////////////////////
- long BasicDevice::InterruptAcknowledge(int)
- {
- if(interrupt_pending)
- {
- interrupt_pending=0;
- return(AUTOVECTOR_INTERRUPT);
- }
- else
- {
- return(SPURIOUS_INTERRUPT);
- }
- }
-
-